package org.ruanjj.reverseList;

import org.ruanjj.linkedlist.ListNode;

public class Solution1 {
    public ListNode reverseList(ListNode head){
        //非递归
        ListNode res = new ListNode(-1);

        while(head != null){
            ListNode tmp = head;
            head = head.next;
            tmp.next = res.next;
            res.next = tmp;
        }

        return res;
    }
}
